﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;
using System.Web.Mvc;

using Microsoft.Practices.Unity;

using ERPStore.Extensions;

namespace ERPStore.Payment.Direct.Services
{
	public class PaymentByCheckService : ERPStore.Services.IPaymentService
	{
		private Models.Settings m_Settings;

		public PaymentByCheckService()
		{
			var container = GlobalConfiguration.Configuration.DependencyResolver.GetContainer();
			m_Settings = container.Resolve<Models.Settings>("paymentByCheckSettings");
		}

		#region IPaymentService Members

		public string Name
		{
			get 
			{
				return "check";
			}
		}

		public string ConfirmationViewName
		{
			get 
			{
				return m_Settings.ConfirmationViewName;
			}
		}

		public string FinalizedViewName
		{
			get
			{
				return m_Settings.FinalizedViewName;
			}
		}

		public string ConfirmationRouteName
		{
			get
			{
				return m_Settings.ConfirmationRouteName ?? "CheckPaymentConfirmation.cshtml";
			}
		}

		public string FinalizedRouteName
		{
			get
			{
				return m_Settings.FinalizedRouteName ?? "CheckPaymentFinalized.cshtml";
			}
		}

		public virtual bool IsAllowedFor(ERPStore.Models.OrderCart cart, ERPStore.Models.UserPrincipal principal)
		{
			return true;
		}

		#endregion
	}
}
